package com.example.pageradapterdemo.fragment;

import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.example.pageradapterdemo.R;
import com.example.pageradapterdemo.base.BasePageFragment;

import java.util.Date;

public class Demo1Fragment extends BasePageFragment {
    public static final String KEY_TITLE = "key_title";
    private boolean isCreateView;
    private View view;
    private TextView tvTitle;
    public static Demo1Fragment newInstance(String title) {

        Bundle args = new Bundle();
        args.putString(KEY_TITLE,title);
        Demo1Fragment fragment = new Demo1Fragment();
        fragment.setArguments(args);
        return fragment;
    }
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        isCreateView = true;
        view = inflater.inflate(R.layout.adapter_viewpager_item,container,false);
        return view;
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        tvTitle = view.findViewById(R.id.tv_title);
        Bundle args = getArguments();
        if (args != null) {
            String title = args.getString(KEY_TITLE,"");
            tvTitle.setText("我的标题是：" + title);
        }
    }

    @Override
    public void fetchData() {
        Log.e("fetchData","11111");
    }
}
